package com.xrui.hbase.filter;

/**
 * Utility class to manipulate row and column filters.
 */

public final class Filters {

    /**
     * Utility class may not be instantiated.
     */
    private Filters() {
    }

    /**
     * Combines row filters using a logical OR.
     *
     * @param filters Ordered list of row filters to combine using a logical OR.
     *                Nulls are filtered out.
     * @return a row filter combining the specified row filters using a logical OR.
     */
    public static RowFilter or(RowFilter... filters) {
        return new OrRowFilter(filters);
    }

    /**
     * Combines row filters using a logical AND.
     *
     * @param filters Ordered list of row filters to combine using a logical AND.
     *                Nulls are filtered out.
     * @return a row filter combining the specified row filters using a logical AND.
     */
    public static RowFilter and(RowFilter... filters) {
        return new AndRowFilter(filters);
    }

    /**
     * Combines column filters using a logical OR.
     *
     * @param filters Ordered list of column filters to combine using a logical OR.
     *                Nulls are filtered out.
     * @return a column filter combining the specified column filters using a logical OR.
     */
    public static ColumnFilter or(ColumnFilter... filters) {
        return new OrColumnFilter(filters);
    }

    /**
     * Combines column filters using a logical AND.
     *
     * @param filters Ordered list of column filters to combine using a logical AND.
     *                Nulls are filtered out.
     * @return a column filter combining the specified column filters using a logical AND.
     */
    public static ColumnFilter and(ColumnFilter... filters) {
        return new AndColumnFilter(filters);
    }
}
